package in.zapr.druid.druidry;

import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;

import java.util.List;
import java.util.TreeSet;

@Getter
public class CustomBucketsPostAggregator extends DruidPostAggregator {
    private static final String CUSTOMBUCKET_POST_AGGREGATOR_TYPE = "customBuckets";
    private String name;
    private String fieldName;
    private TreeSet<Double> breaks;

    @Builder
    private CustomBucketsPostAggregator(@NonNull final String name, @NonNull final String fieldName, @NonNull final List<Double> breaks){
        this.type = CUSTOMBUCKET_POST_AGGREGATOR_TYPE;
        this.name = name;
        this.fieldName = fieldName;
        this.breaks = new TreeSet<>(breaks);
    }
}
